#include <cstdio>
#include <map>

const int N = 10000005;
int n, k, cnt;
int factor[N];
std::map<int, int> map;

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("P4571 [JSOI2009]瓶子和燃料.in", "r", stdin);
  freopen("P4571 [JSOI2009]瓶子和燃料.out", "w", stdout);
#endif
#endif

  scanf("%d%d", &n, &k);
  for (int i = 1, v; i <= n; ++i) {
    scanf("%d", &v);
    for (int j = 1; j * j <= v; ++j) {
      if (v % j == 0) {
        if (map.find(j) == map.end()) { factor[++cnt] = j; }
        if (map.find(v / j) == map.end()) factor[++cnt] = v / j;
        map[j]++;
        if (j * j != v) map[v / j]++;
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= cnt; ++i) {
    if (map[factor[i]] >= k) ans = std::max(factor[i], ans);
  }
  printf("%d", ans);
  return 0;
}
